#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project ：turbo 
@File    ：filters.py
@Author  ：赵加响
@Date    ：2023/4/21 15:22 
@Desc    ：
"""
import django_filters

from apps.accounts.models import User


class UserFilter(django_filters.rest_framework.FilterSet):
    """
    User List接口过滤类
    """
    username = django_filters.CharFilter(field_name='username', lookup_expr='contains')
    name = django_filters.CharFilter(field_name='name', lookup_expr='contains')
    email = django_filters.CharFilter(field_name='email', lookup_expr='contains')
    is_active = django_filters.BooleanFilter(field_name='is_active', lookup_expr='exact')
    init_status = django_filters.BooleanFilter(field_name='init_status', lookup_expr='exact')

    class Meta:
        model = User
        fields = ['username', 'name', 'email', 'is_active', 'init_status']
